//大图
var bannerswiper = new Swiper('.banner-imgbox', {
    autoplay: {
        delay: 5000,
        disableOnInteraction: false,
    },
    loop: true,
    autoHeight: true,
    navigation: {
        nextEl: '.next',
        prevEl: '.prev',
    },
    slidesPerView: 1,
    //spaceBetween: 20,
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    breakpoints: {
        991: {
            lazy: true,
        },
    }
});

$(document).ready(function () {
    // PC导航定位
    var topheight = $(".topbox").outerHeight();
    var headerheight = $(".header").outerHeight();
    var scrollTopheight = topheight + headerheight;
    $("nav").css("top", scrollTopheight);

    $(window).scroll(function () {
        if ($(this).scrollTop() > scrollTopheight) {
            $("nav").css({
                "position": "fixed",
                "top":"0"
            });

        } else {
            $("nav").css({
                "position": "absolute",
                "top": scrollTopheight
            });
        }
    })
    // 手机导航定位
    if (screen.width < 991) {
        var topheight = $(".topbox").outerHeight();
        var headerheight = $(".header").outerHeight();
        var scrollTopheight = topheight + headerheight;
        $("nav").css("top", "0");

        $(window).scroll(function () {
            if ($(this).scrollTop() > topheight) {
                $(".header").css({
                    "position": "fixed",
                    //"top": "0"
                });
                $("nav").css({
                    "position": "fixed",
                    "top": headerheight
                });

            } else {
                $(".header").css({
                    "position": "relative",
                    //"top": scrollTopheight
                });
                $("nav").css({
                    "position": "relative",
                    "top": "0"
                });
            }
        })
    }

    //设备展示
    var equswiper = new Swiper('.equ-imgbox', {
        autoplay: {
            delay: 5000,
            disableOnInteraction: false,
        },//自动滚动
        loop: true, //循环滚动
        navigation: {
            nextEl: '.equ-next',
            prevEl: '.equ-prev',
        },//箭头
        slidesPerView: 4, //个数
        spaceBetween: 25, //间距
        breakpoints: {
            //横向平板
            1024: {
                paceBetween: 20,
            },
            //竖向平板
            991: {
                slidesPerView: 3,
                spaceBetween: 15
            },
            //手机
            767: {
                slidesPerView: 2,
                spaceBetween: 10
            }
        }
    });

    //PC左侧下拉
    $(".gsjianjie_box .gsjianjie_left ul li").click(function(){
        $(".gsjianjie_box .gsjianjie_left ul li>div").slideUp(500);
       if($(this).find("div").is(":hidden")){
           $(this).find("div").slideDown(500)
       }else{
           $(this).find("div").slideUp(500)
       }
    })

    //手机导航下拉
    $(".icon-menu").click(function () {
        $("nav ul").slideToggle("slow");
    });

    //手机下拉
    if (screen.width < 767) {
        $(".about_title").click(function () {
            $(".about_ul").slideToggle("slow");
        });
    }


    //手机底部
    $(".bottom a").eq(2).click(function () {
        if ($(".dbbox .dbs.ewm-box").is(':hidden')) {
            $(".dbbox .dbs.ewm-box").slideDown();
            $(".dbbox .dbs.fenxiang-box").slideUp();
        } else {
            $(".dbbox .dbs.ewm-box").slideUp();
        }
    })
});

